package com.team1.system.blockchain.domain;


import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

@Repository
public class BlockCache {

    /**
     * 当前节点的区块链结构
     */
    private List<Block> blockChain = new CopyOnWriteArrayList<Block>();
    private List<Transaction> transactions = new CopyOnWriteArrayList<Transaction>();

    public List<Block> getBlockChain() {
        return blockChain;
    }

    public void setBlockChain(List<Block> blockChain) {
        this.blockChain = blockChain;
    }

    public Block getLatestBlock() {
        Block latestBlock=blockChain.get(blockChain.size()-1);
        return latestBlock;
    }

    public List<Transaction> getPackedTransactions() {
        return transactions;
    }
}

